From 0b9f6985b1a255fc044e1eb279c19ff62406eb0b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Sep 2021 23:08:09 -0400 Subject: [PATCH] texture: Document constructors as threadsafe We aren't providing async loading apis here, but we want to allow applications to create textures in a thread, to avoid blocking the main thread. --- gdk/gdktexture.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c index 3f602cc5cc..e04adfbb33 100644 --- a/gdk/gdktexture.c +++ b/gdk/gdktexture.c @@ -409,6 +409,10 @@ gdk_texture_new_for_surface (cairo_surface_t *surface) * * Creates a new texture object representing the `GdkPixbuf`. * + * This function is threadsafe, so that you can e.g. use GTask + * and g_task_run_in_thread() to avoid blocking the main thread + * while loading a big image. + * * Returns: a new `GdkTexture` */ GdkTexture * @@ -451,6 +455,10 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf) * If you are unsure about the validity of a resource, use * [ctor@Gdk.Texture.new_from_file] to load it. * + * This function is threadsafe, so that you can e.g. use GTask + * and g_task_run_in_thread() to avoid blocking the main thread + * while loading a big image. + * * Return value: A newly-created `GdkTexture` */ GdkTexture * @@ -489,6 +497,10 @@ gdk_texture_new_from_resource (const char *resource_path) * * If %NULL is returned, then @error will be set. * + * This function is threadsafe, so that you can e.g. use GTask + * and g_task_run_in_thread() to avoid blocking the main thread + * while loading a big image. + * * Return value: A newly-created `GdkTexture` */ GdkTexture * @@ -578,6 +590,10 @@ gdk_texture_new_from_bytes_pixbuf (GBytes *bytes, * * If %NULL is returned, then @error will be set. * + * This function is threadsafe, so that you can e.g. use GTask + * and g_task_run_in_thread() to avoid blocking the main thread + * while loading a big image. + * * Return value: A newly-created `GdkTexture` * * Since: 4.6 @@ -620,6 +636,10 @@ gdk_texture_new_from_bytes (GBytes *bytes, * * If %NULL is returned, then @error will be set. * + * This function is threadsafe, so that you can e.g. use GTask + * and g_task_run_in_thread() to avoid blocking the main thread + * while loading a big image. + * * Return value: A newly-created `GdkTexture` */ GdkTexture * -- 2.30.2